package com.zhhs.galaxyott.activity.movieDetailActivity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.GridView;

import com.zhhs.galaxyott.Constant;
import com.zhhs.galaxyott.R;
import com.zhhs.galaxyott.sharepreference.SharedPrefHelper;
import com.zhhs.galaxyott.utils.Logs;

public class MovieDetailActivity extends Activity {

    GridView lvMovie;

    int movieid;
    String vodId;
    public SharedPrefHelper sp;
    private MovieDetailPresenter mPresenter;
    private MovieDetailHolder mHolder;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_movie_detail);

        sp = SharedPrefHelper.getInstance(this);

        //应用内传递的参数
        movieid = getIntent().getIntExtra("movieid", 0);
        //第三方应用跳转传递的参数
        vodId = getIntent().getStringExtra("vodId");

        Logs.logD("DEBUG_dt", "this is movieid : " + movieid);
        Logs.logD("DEBUG_dt", "this is vodId : " + vodId);
        if (movieid != 0) {
            Constant.paymovieId = movieid;
        } else{
        	movieid = Constant.paymovieId;
        }
        mPresenter = new MovieDetailPresenter(this);
        mHolder = new MovieDetailHolder(this, mPresenter);
        mPresenter.attachView(mHolder);
        mPresenter.loadData();
        // getPayresult();
    }

    @Override
    protected void onResume() {
        super.onResume();
        Logs.logD("DEBUG_LC", "THIS IS ONResume");
        if (MovieDetailPresenter.isOrder || sp.getIsVip()) {
            mHolder.operate_purchase.setText("播放");
            mHolder.operate_vip.setVisibility(View.GONE);
        }
    }
}
